///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#ifndef __CAMERA_H__
#define __CAMERA_H__

#include <Config.h>
#include <Scene/Mover.h>
#include <Math/Vec3f.h>
#include <Math/Matrix4x4.h>

//-----------------------------------------------------------------------------

class Camera
	:	public Mover
{
public:
	/*
	*	Constructor/destructor
	*/
							Camera ();
	virtual					~Camera();

	/*
	*	Update
	*/
	virtual void			Update( f32 dt );

	/*
	*	Camera internals
	*/
	virtual	void			SetFov(f32 fov);
	virtual	f32				GetFov();
	virtual	void			SetAspectRatio(f32 ratio);
	virtual	f32				GetAspectRatio();
	virtual	void			SetNear(f32 dist);
	virtual	f32				GetNear();
	virtual	void			SetFar(f32 dist);
	virtual	f32				GetFar();
	virtual	void			SetViewportSize(s32 width, s32 height);

	virtual	Vec3f			GetForward();
	virtual	Vec3f			GetUp();
	virtual	Vec3f			GetRight();

	/*
	*	Matrix getters
	*/
	virtual	f32*			getProjection();
	virtual	f32*			getView();
	virtual	f32*			getWVP();
	virtual	Matrix4x4		getProjectionMatrix();
	virtual	Matrix4x4		getViewMatrix();
	virtual	Matrix4x4		getWVPMatrix();

	/*
	*	Moving functions
	*/
	virtual	void			moveAlongForward ( f32 dist );
	virtual	void			moveAlongRight ( f32 dist );
	virtual	void			moveAlongUp ( f32 dist );

	//virtual	void			makeUp();

	/*
	*	Rotation functions
	*/
	virtual	void			rotateAroundForward ( f32 angle );
	virtual	void			rotateAroundRight ( f32 angle );
	virtual	void			rotateAroundUp ( f32 angle );

	virtual	void			rotateAroundX ( f32 angle );
	virtual	void			rotateAroundY ( f32 angle );
	virtual	void			rotateAroundZ ( f32 angle );

protected:
	virtual	void			refresh ();

private:
	Vec3f 					m_look;
	Vec3f 					m_right;
	Vec3f 					m_up;

	Matrix4x4				m_view;
	Matrix4x4				m_projection;
	Matrix4x4				m_wvp;

	bool					m_needProjectionRefresh;

	f32						m_fov;
	f32						m_aspect;
	f32						m_near;
	f32						m_far;
};

#endif // __CAMERA_H__
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
